# 设置目标系统
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR arm)
 
# 设置工具链目录
set(TOOL_CHAIN_DIR /opt/gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu)
SET(CMAKE_SYSROOT "${TOOL_CHAIN_DIR}/aarch64-none-linux-gnu/sysroot")

set(TOOL_CHAIN_INCLUDE 
    ${CMAKE_SYSROOT}/usr/local/include
    ${CMAKE_SYSROOT}/usr/local/include/freetype2
)
    
set(TOOL_CHAIN_LIB 
    ${CMAKE_SYSROOT}/usr/local/lib
    ${CMAKE_SYSROOT}/usr/local/detect/lib
    ${CMAKE_SYSROOT}/usr/local/corelib
    ${CMAKE_SYSROOT}/usr/local/cuda-9.0/lib64
)

# 设置编译器位置
set(CMAKE_C_COMPILER "${TOOL_CHAIN_DIR}/bin/aarch64-none-linux-gnu-gcc")
set(CMAKE_CXX_COMPILER "${TOOL_CHAIN_DIR}/bin/aarch64-none-linux-gnu-g++")

# 设置Cmake查找主路径
set(CMAKE_FIND_ROOT_PATH ${CMAKE_SYSROOT})

set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
# 只在指定目录下查找库文件
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
# 只在指定目录下查找头文件
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
# 只在指定目录下查找依赖包
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)

set(CMAKE_INCLUDE_PATH 
    ${TOOL_CHAIN_INCLUDE}
    )

set(CMAKE_LIBRARY_PATH 
    ${TOOL_CHAIN_LIB}
    )
set(ZLIB_LIBRARY ${CMAKE_SYSROOT}/usr/local/lib/libz.a)
set(ZLIB_INCLUDE_DIR ${CMAKE_SYSROOT}/usr/local/include)
